package cn.dt.dthouse.service;

import cn.dt.dthouse.mapper.HouseinfoMapper;
import cn.dt.dthouse.mapper.ViewhouseMapper;
import cn.dt.dthouse.pojo.Houseinfo;
import cn.dt.dthouse.pojo.Viewhouse;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class HouseInfoServiceImpl implements HouseInfoService{
    @Resource
    HouseinfoMapper mapper;
    @Resource
    ViewhouseMapper mapper2;
    @Override
    public PageInfo<Viewhouse> getSelectHousePageInfo(Integer pageNum, Integer pagpeSize) {
        PageHelper.startPage(pageNum,pagpeSize);
        List<Viewhouse> list=mapper2.selectByExample(null);
        PageInfo<Viewhouse> pageInfo=new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public int insert(Houseinfo houseinfo) {
        return mapper.insertSelective(houseinfo);
    }

    @Override
    public Houseinfo getSelecthouse(Integer id) {
        return mapper.selectByPrimaryKey(id);
    }
}
